2025-01-25 15:58:16 +00:00
2025-01-25 15:58:16 +00:00
2025-01-25 14:58:19 +00:00
2025-01-25 14:58:19 +00:00
2025-01-25 15:58:16 +00:00
2025-01-25 14:58:19 +00:00
2025-01-25 14:58:19 +00:00

Backup and Maintenance Scripts

This repository contains four primary scripts to manage system updates, installations, backups, and uploads to Backblaze B2.

1. setup.sh

Installs essential packages, sets up pipx, installs b2 CLI, and creates required directories.

Usage:

  1. Run ./setup.sh after cloning or copying these scripts to a machine.
  2. Confirms that pipx and the Backblaze B2 CLI tool are installed.
  3. Creates necessary directories (tmp/gitea and /mnt/nas/important/backups/mybackup).

2. full_backup.sh

Coordinates the entire backup process by running the local backup (backup.sh), followed by the B2 upload script (b2_upload.sh). If any step fails, a Pushover notification is sent. When run with the --debug flag, it also sends a success notification.

Usage:

  1. Ensure .pushover contains valid Pushover credentials (APP_TOKEN and USER_KEY).
  2. Run with ./full_backup.sh [--debug].
  3. Upon failure, a notification is pushed with priority.

3. backup.sh

Creates a password-protected archive of a Gitea backup and places it in your backup destination with retention management.

This backup script runs application-specific backup scripts and then stores their output on a NAS. It could/should be extended to store the output from other apps apart from Gitea.

Usage:

  1. Ensure .password has been created with a valid password.
  2. Verify script paths and permissions in backup.sh (notably the GITEA_BACKUP_SCRIPT and DESTINATION variables).
  3. Run ./backup.sh to initiate the archive and encryption process.
  4. Handles old backups exceeding the retention policy (default: 31 days).

4. b2_upload.sh

Collects the most recent backup files from multiple directories (Gitea, Paperless, ...), bundles them into a single passwordprotected ZIP, and uploads to Backblaze B2 using b2 CLI.

Usage:

  1. Ensure .backblaze_api_key contains two lines: the B2 Application Key ID and the Application Key.
  2. Make sure .password contains the encryption password for the ZIP file.
  3. Adjust BACKUP_DIRS in the script to point to the directories holding recent backups.
  4. Run ./b2_upload.sh to authenticate, create a ZIP file of the newest items, and push it to B2.
  5. Retains only 14 latest ZIP files on the B2 bucket by removing older backups.

5. update_dependencies.sh

Performs system updates and upgrades pipx-managed packages.

Usage:

  1. Run ./update_dependencies.sh (ensure the script is executable).
  2. It updates system packages and attempts to upgrade pipx along with b2 CLI.

Additional Notes

  • All scripts rely on correct file permissions and ownership. Confirm each script is executable with chmod +x.
  • Examine script contents for custom paths and adjust as needed (e.g., BACKUP_SCRIPT_DIR, DESTINATION).
  • Store sensitive information (.password, .backblaze_api_key) securely with restricted permissions.
Description
Backup scripts for backing up various devices
Readme 38 KiB
Languages
Shell 100%